gdk_device_get_vendor_id
gdk_device_get_product_id
gdk_device_get_source
-gdk_device_get_device_type
gdk_device_get_display
gdk_device_get_has_cursor
gdk_device_get_seat
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Core Pointer",
- "type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", display,
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Core Keyboard",
- "type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", display,
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Pointer",
- "type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", display,
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Keyboard",
- "type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", display,
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Touchscreen",
- "type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_TOUCHSCREEN,
"has-cursor", FALSE,
"display", display,
PROP_0,
PROP_DISPLAY,
PROP_NAME,
- PROP_TYPE,
PROP_SOURCE,
PROP_HAS_CURSOR,
PROP_N_AXES,
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
- /**
- * GdkDevice:type:
- *
- * Device role in the device manager.
- */
- device_props[PROP_TYPE] =
- g_param_spec_enum ("type",
- P_("Device type"),
- P_("Device role in the device manager"),
- GDK_TYPE_DEVICE_TYPE,
- GDK_DEVICE_TYPE_LOGICAL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
/**
* GdkDevice:source:
/**
* GdkDevice:has-cursor:
*
- * Whether the device is represented by a cursor on the screen. Devices of type
- * %GDK_DEVICE_TYPE_LOGICAL will have %TRUE here.
+ * Whether the device is represented by a cursor on the screen.
*/
device_props[PROP_HAS_CURSOR] =
g_param_spec_boolean ("has-cursor",
GdkDevice *device = GDK_DEVICE (object);
GdkDevice *associated = device->associated;
- if (associated && device->type == GDK_DEVICE_TYPE_PHYSICAL)
+ if (associated)
_gdk_device_remove_physical_device (associated, device);
if (associated)
{
device->associated = NULL;
- if (device->type == GDK_DEVICE_TYPE_LOGICAL &&
- associated->associated == device)
+ if (associated->associated == device)
_gdk_device_set_associated_device (associated, NULL);
g_object_unref (associated);
device->name = g_value_dup_string (value);
break;
- case PROP_TYPE:
- device->type = g_value_get_enum (value);
- break;
case PROP_SOURCE:
device->source = g_value_get_enum (value);
break;
case PROP_NAME:
g_value_set_string (value, device->name);
break;
- case PROP_TYPE:
- g_value_set_enum (value, device->type);
- break;
case PROP_SOURCE:
g_value_set_enum (value, device->source);
break;
{
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (device->source != GDK_SOURCE_KEYBOARD);
- g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_PHYSICAL ||
- gdk_display_device_is_grabbed (gdk_device_get_display (device), device));
_gdk_device_query_state (device, NULL, NULL, x, y, NULL);
}
* double precision. Returns %NULL if the surface tree under @device is not known to GDK (for example,
* belongs to another application).
*
- * As a physical device coordinates are those of its logical pointer, this
- * function may not be called on devices of type %GDK_DEVICE_TYPE_PHYSICAL,
- * unless there is an ongoing grab on them, see gdk_seat_grab().
- *
* Returns: (nullable) (transfer none): the #GdkSurface under the
* device position, or %NULL.
**/
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, NULL);
- g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_PHYSICAL ||
- gdk_display_device_is_grabbed (gdk_device_get_display (device), device), NULL);
surface = _gdk_device_surface_at_position (device, &tmp_x, &tmp_y, NULL);
return device->display;
}
-static void
-_gdk_device_set_device_type (GdkDevice *device,
- GdkDeviceType type)
-{
- if (device->type != type)
- {
- device->type = type;
-
- g_object_notify_by_pspec (G_OBJECT (device), device_props[PROP_TYPE]);
- }
-}
-
void
_gdk_device_set_associated_device (GdkDevice *device,
GdkDevice *associated)
if (associated)
device->associated = g_object_ref (associated);
-
- if (device->type != GDK_DEVICE_TYPE_LOGICAL)
- {
- if (device->associated)
- _gdk_device_set_device_type (device, GDK_DEVICE_TYPE_PHYSICAL);
- else
- _gdk_device_set_device_type (device, GDK_DEVICE_TYPE_FLOATING);
- }
}
/**
gdk_device_list_physical_devices (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
- g_return_val_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL, NULL);
return g_list_copy (device->physical_devices);
}
_gdk_device_add_physical_device (GdkDevice *device,
GdkDevice *physical)
{
- g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL);
- g_return_if_fail (gdk_device_get_device_type (physical) != GDK_DEVICE_TYPE_LOGICAL);
-
if (!g_list_find (device->physical_devices, physical))
device->physical_devices = g_list_prepend (device->physical_devices, physical);
}
{
GList *elem;
- g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL);
- g_return_if_fail (gdk_device_get_device_type (physical) != GDK_DEVICE_TYPE_LOGICAL);
-
elem = g_list_find (device->physical_devices, physical);
if (elem == NULL)
return;
device->physical_devices = g_list_delete_link (device->physical_devices, elem);
}
-/**
- * gdk_device_get_device_type:
- * @device: a #GdkDevice
- *
- * Returns the device type for @device.
- *
- * Returns: the #GdkDeviceType for @device.
- **/
-GdkDeviceType
-gdk_device_get_device_type (GdkDevice *device)
-{
- g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_DEVICE_TYPE_LOGICAL);
-
- return device->type;
-}
-
/**
* gdk_device_get_n_axes:
* @device: a pointer #GdkDevice
gdk_device_get_vendor_id (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
- g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_LOGICAL, NULL);
return device->vendor_id;
}
gdk_device_get_product_id (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
- g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_LOGICAL, NULL);
return device->product_id;
}
GdkDeviceTool *tool)
{
g_return_if_fail (GDK_IS_DEVICE (device));
- g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_LOGICAL);
if (g_set_object (&device->last_tool, tool))
{
GDK_SOURCE_TABLET_PAD
} GdkInputSource;
-/**
- * GdkDeviceType:
- * @GDK_DEVICE_TYPE_LOGICAL: Device is a logical device. There will
- * be an associated focus indicator on the screen.
- * @GDK_DEVICE_TYPE_PHYSICAL: Device is a physical device.
- * @GDK_DEVICE_TYPE_FLOATING: Device is a physical device, currently
- * not attached to any seat.
- *
- * Indicates the device type.
- */
-typedef enum {
- GDK_DEVICE_TYPE_LOGICAL,
- GDK_DEVICE_TYPE_PHYSICAL,
- GDK_DEVICE_TYPE_FLOATING
-} GdkDeviceType;
-
-
/**
* GdkTimeCoord:
* @time: The timestamp for this event.
GDK_AVAILABLE_IN_ALL
GdkDisplay * gdk_device_get_display (GdkDevice *device);
-GDK_AVAILABLE_IN_ALL
-GdkDeviceType gdk_device_get_device_type (GdkDevice *device);
-
GDK_AVAILABLE_IN_ALL
const char *gdk_device_get_vendor_id (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
char *name;
GdkInputSource source;
gboolean has_cursor;
- GdkDeviceType type;
GdkDisplay *display;
/* The paired logical device for logical devices,
* or the associated logical device for physical ones
if (grab == NULL /* ungrab */ ||
(!last_grab->owner_events && grab->owner_events) /* switched to owner_events */ )
{
- /* Ungrabbed physical devices don't have a position by
- * itself, rather depend on its logical pointer, so
- * it doesn't make sense to track any position for
- * these after the grab
- */
- if (grab || gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_PHYSICAL)
+ if (grab)
new_toplevel = get_current_toplevel (display, device, &x, &y, &state);
if (new_toplevel)
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
- g_return_val_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL, NULL);
return g_hash_table_lookup (surface->device_cursor, device);
}
g_return_if_fail (GDK_IS_SURFACE (surface));
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
- g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL);
if (!cursor)
g_hash_table_remove (surface->device_cursor, device);
core_pointer = g_object_new (GDK_TYPE_MACOS_DEVICE,
"name", "Core Pointer",
- "type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", display,
NULL);
core_keyboard = g_object_new (GDK_TYPE_MACOS_DEVICE,
"name", "Core Keyboard",
- "type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", display,
logical_name = g_strdup_printf ("Logical pointer for %s", tablet->name);
logical_device = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", logical_name,
- "type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", display,
stylus_device = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", tablet->name,
- "type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_PEN,
"has-cursor", FALSE,
"display", display,
seat->pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Pointer",
- "type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
seat->keyboard = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Keyboard",
- "type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", seat->display,
seat->logical_touch = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Touch Logical Pointer",
- "type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_TOUCHSCREEN,
"has-cursor", TRUE,
"display", seat->display,
seat->touch = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Touch",
- "type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_TOUCHSCREEN,
"has-cursor", FALSE,
"display", seat->display,
{
seat->wheel_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Wheel Scrolling",
- "type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
{
seat->finger_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Finger Scrolling",
- "type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_TOUCHPAD,
"has-cursor", TRUE,
"display", seat->display,
{
seat->continuous_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Continuous Scrolling",
- "type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_TRACKPOINT,
"has-cursor", TRUE,
"display", seat->display,
pad->device =
g_object_new (GDK_TYPE_WAYLAND_DEVICE_PAD,
"name", "Pad device",
- "type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_TABLET_PAD,
"display", gdk_seat_get_display (pad->seat),
"seat", pad->seat,
/* pointer */
seat->logical_pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Core Pointer",
- "type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
/* keyboard */
seat->logical_keyboard = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Core Keyboard",
- "type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", seat->display,
create_pointer (GdkDeviceManagerWin32 *device_manager,
GType g_type,
const char *name,
- GdkDeviceType type)
+ gboolean has_cursor)
{
return g_object_new (g_type,
"name", name,
- "type", type,
"source", GDK_SOURCE_MOUSE,
- "has-cursor", type == GDK_DEVICE_TYPE_LOGICAL,
+ "has-cursor", has_cursor,
"display", _gdk_display,
NULL);
}
static GdkDevice *
create_keyboard (GdkDeviceManagerWin32 *device_manager,
GType g_type,
- const char *name,
- GdkDeviceType type)
+ const char *name)
{
return g_object_new (g_type,
"name", name,
- "type", type,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", _gdk_display,
device = g_object_new (GDK_TYPE_DEVICE_WINTAB,
"name", device_name,
- "type", GDK_DEVICE_TYPE_FLOATING,
"source", GDK_SOURCE_PEN,
"has-cursor", lc.lcOptions & CXO_SYSTEM,
"display", display,
create_pointer (device_manager,
GDK_TYPE_DEVICE_VIRTUAL,
"Virtual Core Pointer",
- GDK_DEVICE_TYPE_LOGICAL);
+ TRUE);
device_manager->system_pointer =
create_pointer (device_manager,
GDK_TYPE_DEVICE_WIN32,
"System Aggregated Pointer",
- GDK_DEVICE_TYPE_PHYSICAL);
+ FALSE);
_gdk_device_virtual_set_active (device_manager->core_pointer,
device_manager->system_pointer);
_gdk_device_set_associated_device (device_manager->system_pointer, device_manager->core_pointer);
device_manager->core_keyboard =
create_keyboard (device_manager,
GDK_TYPE_DEVICE_VIRTUAL,
- "Virtual Core Keyboard",
- GDK_DEVICE_TYPE_LOGICAL);
+ "Virtual Core Keyboard");
device_manager->system_keyboard =
create_keyboard (device_manager,
GDK_TYPE_DEVICE_WIN32,
- "System Aggregated Keyboard",
- GDK_DEVICE_TYPE_PHYSICAL);
+ "System Aggregated Keyboard");
_gdk_device_virtual_set_active (device_manager->core_keyboard,
device_manager->system_keyboard);
_gdk_device_set_associated_device (device_manager->system_keyboard, device_manager->core_keyboard);
if ((caps & GDK_SEAT_CAPABILITY_POINTER) != 0)
{
g_assert_nonnull (pointer0);
- g_assert (gdk_device_get_device_type (pointer0) == GDK_DEVICE_TYPE_LOGICAL);
g_assert (gdk_device_get_display (pointer0) == display);
g_assert (gdk_device_get_seat (pointer0) == seat0);
for (l = physical_devices; l; l = l->next)
{
device = l->data;
- g_assert (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_PHYSICAL);
g_assert (gdk_device_get_display (device) == display);
g_assert (gdk_device_get_seat (device) == seat0);
}
if ((caps & GDK_SEAT_CAPABILITY_KEYBOARD) != 0)
{
g_assert_nonnull (keyboard0);
- g_assert (gdk_device_get_device_type (keyboard0) == GDK_DEVICE_TYPE_LOGICAL);
g_assert (gdk_device_get_display (keyboard0) == display);
g_assert (gdk_device_get_seat (keyboard0) == seat0);
g_assert (gdk_device_get_source (keyboard0) == GDK_SOURCE_KEYBOARD);
for (l = physical_devices; l; l = l->next)
{
device = l->data;
- g_assert (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_PHYSICAL);
g_assert (gdk_device_get_display (device) == display);
g_assert (gdk_device_get_seat (device) == seat0);
g_assert (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD);